<template>
  <LoadingGroup :error="error" :pending="pending" :refresh="refresh">
    <template v-for="(item, index) in data.data" :key="index">
      <Swiper :data="item.data" v-if="item.type == 'swiper'" />
      <CardList :cols="4" :data="item.data" v-if="item.type == 'icons'" />
      <ImgAds :data="item.data" v-if="item.type == 'imageAd'" />
      <CardList
        :cols="4"
        :title="item.title"
        :data="item.data"
        v-if="item.type == 'promotion'"
        show-price
        show-footer
      >
        <template #tfooter>{{ item.updated_time }}</template>
      </CardList>
      <CardList
        :cols="4"
        :title="item.title"
        :data="item.data"
        v-if="item.type == 'list'"
        show-price
      />
    </template>
  </LoadingGroup>
</template>

<script setup lang="ts">
useHead({
  title: "vision",
});

const { data, error, pending, refresh } = await useIndexDataApi();
console.log(data, error, pending, refresh);

// const res = await useLoginApi({
//   username: "ceshi11",
//   password: "123456",
// });
// console.log("result:>>>>>", data.value);

// const x = format(123, 0, 2);
// console.log(x);
// const app = useNuxtApp();
</script>

<style></style>
